<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>选项卡和进度条</title>
    <link rel="stylesheet" href="../layui/css/layui.css">
    <style>
        body {
            margin: 20px;
        }
    </style>
</head>
<body>
<div class="layui-tab layui-tab-card" lay-filter="test1">
    <ul class="layui-tab-title">
        <li class="layui-this" lay-id="111">网站设置</li>
        <li lay-id="222">用户管理</li>
        <li lay-id="333">权限分配</li>
        <li lay-id="444">商品管理</li>
        <li lay-id="555">订单管理</li>
    </ul>
    <div class="layui-tab-content" style="height: 100px;">
        <div class="layui-tab-item layui-show">内容1</div>
        <div class="layui-tab-item">内容2</div>
        <div class="layui-tab-item">内容3</div>
        <div class="layui-tab-item">内容4</div>
        <div class="layui-tab-item">内容5</div>
    </div>
</div>

<br>
<div class="layui-progress">
    <div class="layui-progress-bar " lay-percent="20%"></div>
</div>
<br>
<div class="layui-progress" lay-showPercent="true">
    <div class="layui-progress-bar layui-bg-red" lay-percent="2/3"></div>
</div>
<br>
<div class="layui-progress layui-progress-big" lay-showPercent="true">
    <div class="layui-progress-bar layui-bg-orange" lay-percent="50%"></div>
</div>

<script src="../layui/layui.js"></script>
<script>
    layui.use('element', function () {
        var element = layui.element
        //初始化时，根据url定位到对应的tab
        var layId = location.hash.replace(/^#test1=/, '')
        element.tabChange('test1', layId)
        //tab切换时,将url定位到对应的tab
        element.on('tab(test1)', function () {
            location.hash = 'test1=' + this.getAttribute('lay-id')
        })
    })
</script>
</body>
</html>
